package vip.xiaonuo.megvii.service;

import vip.xiaonuo.modular.devicemegvii.entity.DeviceMegvii;

public class DeviceMegviiBaseService {



    /**
     * 获取设备的请求地址
     * @return
     */
    public static String getMachAddress(DeviceMegvii device){
        if(device==null){
            return null;
        }
        String schema = device.getMachSchemaType();
        String ip = device.getMachServerAddress();
        int port = device.getMachServerPort();

        String url = schema + "://" + ip;
        if( ("http".equals(schema) && port!=80) || ("https".equals(schema) && port!=443) ){
            url += ":"+ port;
        }
        return url;
    }


}
